home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / Sample Editors⁄Viewers / Panel Editor / Source / PanelEditor.r < prev    next >
Encoding:
Text File  |  1995-12-08  |  12.6 KB  |  556 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        PanelEditor.r
  3.  
  4.     Contains:    PanelEditor Resources
  5.  
  6.     Written by:    Steve Smith
  7.  
  8.     Copyright:    © 1994,95 by Apple Computer, Inc., all rights reserved.
  9. */
  10.  
  11. #define SystemSevenOrBetter 1            // we want the extended types
  12. #define    SystemSevenOrLater    1            // Types.r uses this variable
  13.  
  14. // -- MPW Rez Includes --
  15.  
  16. #include "Types.r"
  17. #include "SysTypes.r"
  18. #include "CodeFragmentTypes.r"
  19.  
  20. // -- OpenDoc Includes --
  21.  
  22. #ifndef __ODTYPES_R__
  23. #include "ODTypes.r"
  24. #endif
  25.  
  26. #ifndef SOM_Module_OpenDoc_StdDefs_defined
  27. #include "StdDefs.h"
  28. #endif
  29.  
  30. // -- PanelEditor Includes --
  31.  
  32. #ifndef _PANELEDITORDEF_
  33. #include "PanelEditorDef.h"
  34. #endif
  35.  
  36. #ifndef _PANELEDITORVERS_
  37. #include "PanelEditorVers.h"
  38. #endif
  39.  
  40. //-------------------------------------------------------------------------------------
  41. // .rsrc resources
  42. //-------------------------------------------------------------------------------------
  43.  
  44. // PanelEditor - include resources from my .rsrc file (PICTs etc.)
  45. include "PanelEditorOtherResources.rsrc" not 'ckid';
  46.  
  47. //-------------------------------------------------------------------------------------
  48. // Finder Version Resources
  49. //-------------------------------------------------------------------------------------
  50.  
  51. // Part's Finder Version Resource
  52.  
  53. resource 'vers' (1) {
  54.     currentMajorVersion,
  55.     finderMinorVersion,
  56.     developmentStage,
  57.     preReleaseNumber,
  58.     verUS,
  59.     shortVersionStr,
  60.     shortVersionStr", © Apple Computer, Inc. 1994-1995"
  61. };
  62.  
  63. resource 'vers' (2) {
  64.     currentMajorVersion,
  65.     finderMinorVersion,
  66.     developmentStage,
  67.     preReleaseNumber,
  68.     verUS,
  69.     shortVersionStr,
  70.     "OpenDoc™ Sample Code"
  71. };
  72.  
  73. //-------------------------------------------------------------------------------------
  74. // Code Fragment Resources
  75. //-------------------------------------------------------------------------------------
  76.  
  77. resource 'cfrg' (0) {
  78.     {    /* [1] */
  79. #ifdef _68KBUILD_
  80.         kMotorola,
  81. #else
  82.         kPowerPC,
  83. #endif
  84.         kFullLib,
  85.         currentVersion,
  86.         compatibleVersion,
  87.         kDefaultStackSize,
  88.         kNoAppSubFolder,
  89.         kIsLib,
  90.         kOnDiskFlat,
  91.         kZeroOffset,
  92.         kWholeFork,
  93.         kPanelEditorID,        /* This must be the class ID. */
  94.         /* [2] */
  95. #ifdef _68KBUILD_
  96.         kMotorola,
  97. #else
  98.         kPowerPC,
  99. #endif
  100.         kFullLib,
  101.         currentVersion,
  102.         compatibleVersion,
  103.         kDefaultStackSize,
  104.         kNoAppSubFolder,
  105.         kIsLib,
  106.         kOnDiskFlat,
  107.         kZeroOffset,
  108.         kWholeFork,
  109.         kPartClassName        /* This must be the SOM class name */
  110.                             /* for this part.                   */
  111.     }
  112. };
  113.  
  114. //-------------------------------------------------------------------------------------
  115. // NMAP Resources
  116. //-------------------------------------------------------------------------------------
  117.  
  118. // Map a part's class id (module::classname)
  119. // to a part's kind (unique content identifier)
  120. //
  121. resource kODNameMappings (kEditorKindMapId) {
  122.     kODEditorKinds,
  123.     {    /* array Types: 1 elements */
  124.         /* [1] */
  125.         kPanelEditorID,
  126.         kODIsAnISOStringList
  127.         {
  128.             {    /* array ClassIDs: 1 elements */
  129.                 /* [1] */
  130.                 kPanelEditorKind
  131.             }
  132.         }
  133.     }
  134. };
  135.  
  136. // Map a part's class id (module::classname)
  137. // to the part editor's name
  138. //
  139. resource kODNameMappings (kEditorUserStringMapId) {
  140.     kODEditorUserString,
  141.     {    /* array Types: 1 elements */
  142.         /* [1] */
  143.         kPanelEditorID,
  144.         kODIsINTLText
  145.         {
  146.             smRoman,
  147.             langEnglish,
  148.             kPanelEditorEditorUserString
  149.         }
  150.     }
  151. };
  152.  
  153. // Map a part's kind (unique content identifier)
  154. // to a generic content category identifier
  155. //
  156. resource kODNameMappings (kKindCategoryMapId) {
  157.     kODKind,
  158.     {    /* array Types: 1 elements */
  159.         /* [1] */
  160.         kPanelEditorKind,
  161.         kODIsAnISOStringList
  162.         {
  163.             {    /* array ClassIDs: 1 elements */
  164.                 /* [1] */
  165.                 kODCategorySpace
  166.             }
  167.         }
  168.     }
  169. };
  170.  
  171. // Map a part's kind (unique content identifier)
  172. // to a human readable string.
  173. //
  174. resource kODNameMappings (kKindUserStringMapId) {
  175.     kODKindUserString,
  176.     {    /* array Types: 1 elements */
  177.         /* [1] */
  178.         kPanelEditorKind,
  179.         kODIsINTLText
  180.         {
  181.             smRoman,
  182.             langEnglish,
  183.             kPanelEditorKindUserString
  184.         }
  185.     }
  186. };
  187.  
  188. // Map a part's kind (unique content identifier)
  189. // to an old style MacOS Type (and/or ScrapType)
  190. //
  191. resource kODNameMappings (kOldMacOSTypeMapId) {
  192.     kODKindOldMacOSType,
  193.     {    /* array KeyList: 1 elements */
  194.         /* [1] */
  195.         kPanelEditorKind,
  196.         kODIsMacOSType {
  197.             kPanelEditorDocumentOSType
  198.         }
  199.     }
  200. };
  201.  
  202. //-------------------------------------------------------------------------------------
  203. // OLE Interoperability Support
  204. //-------------------------------------------------------------------------------------
  205.  
  206. // This resource allows your editor to be registered with the OLE runtime on the
  207. // Macintosh and subsequently interoperate with OLE clients/servers. Contact Microsoft
  208. // to acqiure a unique class ID.
  209. resource 'olcr' (0, "OLE Class ID")
  210. {
  211.    "{80C11F40-7503-8576-00D01113F11}"; /* your part's CLSID */
  212. };
  213.  
  214. //-------------------------------------------------------------------------------------
  215. // Finder Related Resources
  216. //-------------------------------------------------------------------------------------
  217.  
  218. // Kind resources affect the text Finder displays in the
  219. // "kind" column and file info dialog. This feature was
  220. // introduced as part of Macintosh Easy Open.
  221. //
  222. resource 'kind' (kBaseResourceID) {
  223.     kPanelEditorEditorOSType,
  224.     0, /* region = USA */
  225.     {
  226.         'shlb', "OpenDoc™ editor"
  227.     }
  228. };
  229.     
  230. resource 'kind' (kBaseResourceID+1) {
  231.     kPanelEditorViewerOSType,
  232.     0, /* region = USA */
  233.     {
  234.         'shlb', "OpenDoc™ viewer"
  235.     }
  236. };
  237.     
  238. resource 'kind' (kBaseResourceID+2) {
  239.     kODShellSignature,
  240.     0, /* region = USA */
  241.     {
  242.         kPanelEditorDocumentOSType, "Panel Editor 1.0 document",
  243.         kPanelEditorStationeryOSType, "Panel Editor 1.0 stationery"
  244.     }
  245. };
  246.  
  247. // The -16397 string will be displayed by Finder when a user
  248. // tries to open the editor shared library. The string should
  249. // give the user a little detail about the part's capabilities
  250. // and enough information to install the part in the correct location.
  251. //
  252. resource 'STR ' (-16397, purgeable) {
  253.     "OpenDoc™ editor\n\n“Panel Editor” allows you to create and edit a documen"
  254.     "t of embedded parts. To work properly, it should be placed in the Editors"
  255.     " folder.  To create a new document, open a stationery pad."
  256. };
  257.  
  258. //-------------------------------------------------------------------------------------
  259. // String Resources
  260. //-------------------------------------------------------------------------------------
  261.  
  262. resource 'STR#' (kMenuStringResID, "Menu Items strings") {
  263.     {    /* array StringArray: 1 elements */
  264.         /* [1] */
  265.         "About Panel Editor…"
  266.     }
  267. };
  268.  
  269. resource 'STR#' (kErrorStringResID, "Error strings") {
  270.     {    /* array StringArray: 4 elements */
  271.         /* [1] */
  272.         "“Panel Editor” was unable completely ini"
  273.         "tialize it's internal structures.",
  274.         /* [2] */
  275.         "“Panel Editor” was unable to open the do"
  276.         "cument due to unforseen circumstances.",
  277.         /* [3] */
  278.         "“Panel Editor” was unable to open a part"
  279.         " window due to unforseen circumstances.",
  280.         /* [4] */
  281.         "“Panel Editor” has been asked to remove "
  282.         "a frame that does not belong to it, or a"
  283.         "n error occurred while removing the fram"
  284.         "e from internal storage.",
  285.         /* [5] */
  286.         "A window that “Panel Editor” created has"
  287.         " been deleted without its knowledge. Thi"
  288.         "s may generate a fatal error in the near"
  289.         " future. Please close the document immed"
  290.         "iately to prevent data loss.",
  291.         /* [6] */
  292.         "“Panel Editor” encountered a fatal error"
  293.         " while trying to save. Try saving again "
  294.         "or closing the document."
  295.     }
  296. };
  297.  
  298. resource 'STR#' (kUndoStringResID, "Undo Strings") {
  299.     {    /* array StringArray: 10 elements */
  300.         /* [1] */
  301.         "Undo Cut",
  302.         /* [2] */
  303.         "Redo Cut",
  304.         /* [3] */
  305.         "Undo Paste",
  306.         /* [4] */
  307.         "Redo Paste",
  308.         /* [5] */
  309.         "Undo Clear",
  310.         /* [6] */
  311.         "Redo Clear",
  312.         /* [7] */
  313.         "Undo Drop",
  314.         /* [8] */
  315.         "Redo Drop",
  316.         /* [9] */
  317.         "Undo Drag",
  318.         /* [10] */
  319.         "Redo Drag"
  320.     }
  321. };
  322.  
  323. resource 'STR#' (kItemNameResID, "Untitled Item name") {
  324.     {    /* array StringArray: 1 elements */
  325.         /* [1] */
  326.         "<untitled>"
  327.     }
  328. };
  329.  
  330. //-------------------------------------------------------------------------------------
  331. // Menu Resources
  332. //-------------------------------------------------------------------------------------
  333.  
  334. resource 'MENU' (kPanelMenuID) {
  335.     kPanelMenuID,
  336.     textMenuProc,
  337.     allEnabled,
  338.     enabled,
  339.     "Panel",
  340.     {    /* array: 2 elements */
  341.         /* [1] */
  342.         "Layout", noIcon, noKey, check, plain,
  343.         /* [2] */
  344.         "Browse", noIcon, noKey, noMark, plain
  345.     }
  346. };
  347.  
  348. //-------------------------------------------------------------------------------------
  349. // Dialog Resources
  350. //-------------------------------------------------------------------------------------
  351.  
  352. resource 'DLOG' (kAboutBoxID, "About Box") {
  353.     {0, 0, 250, 350},
  354.     dBoxProc,
  355.     visible,
  356.     goAway,
  357.     0x0,
  358.     kAboutBoxID,
  359.     "",
  360.     alertPositionMainScreen
  361. };
  362.  
  363. resource 'DITL' (kAboutBoxID) {
  364.     {    /* array DITLarray: 8 elements */
  365.         /* [1] */
  366.         {222, 270, 242, 338}, Button { enabled, "OK" },
  367.         /* [2] */
  368.         {24, 25, 56, 57}, Picture { disabled, kEditorIconPicture },
  369.         /* [3] */
  370.         {13, 68, 237, 69}, Button { disabled, "" },
  371.         /* [4] */
  372.         {64, 13, 65, 337}, Button { disabled, "" },
  373.         /* [5] */
  374.         {46, 76, 62, 172}, StaticText { disabled, "Panel Editor" },
  375.         /* [6] */
  376.         {76, 76, 116, 304}, StaticText { disabled,
  377.             "PanelEditor is a sample part editor which"
  378.             " illustrates the functionality of a basi"
  379.             "c embedding part editor." },
  380.         /* [7] */
  381.         {124, 76, 152, 304}, StaticText { disabled,
  382.             "Written by Steve Smith with support from"
  383.             " the OpenDoc™ Engineering team." },
  384.         /* [8] */
  385.         {172, 76, 200, 300}, StaticText { disabled,
  386.             "Copyright© 1994,1995 by Apple Computer, "
  387.             "Inc. All Rights Reserved." },
  388.         /* [9] */
  389.         {51, 272, 64, 340}, StaticText { disabled,
  390.             "Version "shortVersionStr }
  391.     }
  392. };
  393.  
  394. resource 'dctb' (kAboutBoxID) {
  395.     /* dialog background fill color */
  396.     {    /* array ColorSpec: 5 elements */
  397.         /* [1] */
  398.         wContentColor, 59127, 59127, 59127,
  399.         /* [2] */
  400.         wFrameColor, 0, 0, 0,
  401.         /* [3] */
  402.         wTextColor, 0, 0, 0,
  403.         /* [4] */
  404.         wHiliteColor, 0, 0, 0,
  405.         /* [5] */
  406.         wTitleBarColor, 65535, 65535, 65535
  407.     }
  408. };
  409.  
  410. data 'ictb' (kAboutBoxID) {
  411.     /* dialog control text styling */
  412.     $"0000000000000000002800240028"
  413.     $"004C80070074800700888007009C"
  414.     $"800700B0800700C4000000000000"
  415.     $"000300007FFF7FFF7FFF0001FFFF"
  416.     $"FFFFFFFF00020000000000000003"
  417.     $"FFFFFFFFFFFF0000000000000003"
  418.     $"00007FFF7FFF7FFF0001FFFFFFFF"
  419.     $"FFFF00020000000000000003FFFF"
  420.     $"FFFFFFFF00D80100000E00000000"
  421.     $"0000FFFFFFFFFFFF000000E10000"
  422.     $"0009000000000000FFFFFFFFFFFF"
  423.     $"000000E800000009000000000000"
  424.     $"FFFFFFFFFFFF000000EF00000009"
  425.     $"000000000000FFFFFFFFFFFF0000"
  426.     $"00F600000009000000000000FFFF"
  427.     $"FFFFFFFF00000850616C6174696E"
  428.     $"6F0647656E6576610647656E6576"
  429.     $"610647656E6576610647656E6576"
  430.     $"61"
  431. };
  432.  
  433. resource 'DLOG' (kErrorBoxID, "Error Box") {
  434.     {57, 46, 244, 374},
  435.     dBoxProc,
  436.     visible,
  437.     goAway,
  438.     0x0,
  439.     kErrorBoxID,
  440.     "",
  441.     alertPositionParentWindowScreen
  442. };
  443.  
  444. resource 'DITL' (kErrorBoxID) {
  445.     {    /* array DITLarray: 5 elements */
  446.         /* [1] */
  447.         {153, 256, 173, 314}, Button { enabled, "OK" },
  448.         /* [2] */
  449.         {153, 185, 173, 243}, Button { enabled, "Cancel" },
  450.         /* [3] */
  451.         {11, 70, 124, 317}, StaticText { disabled,
  452.             "<< Use this for errors in the Editor, su"
  453.             "ch as out of memory, unable to acquire s"
  454.             "ome system resource, etc.>> \nUser errors"
  455.             " use a standard alert appearance. See DI"
  456.             "TL 129.>>" },
  457.         /* [4] */
  458.         {11, 19, 43, 51}, Picture { disabled, kEditorIconPicture },
  459.         /* [5] */
  460.         {149, 252, 177, 318}, UserItem { disabled }
  461.     }
  462. };
  463.  
  464. //-------------------------------------------------------------------------------------
  465. // Finder Bundle Information
  466. //-------------------------------------------------------------------------------------
  467.  
  468. resource 'BNDL' (kDocumentBundle, "Document BNDL") {
  469.     kODShellSignature,
  470.     0,
  471.     {    /* array TypeArray: 2 elements */
  472.         /* [1] */
  473.         'FREF',
  474.         {    /* array IDArray: 2 elements */
  475.             /* [1] */
  476.             0, kDocumentFREF,
  477.             /* [2] */
  478.             1, kStationeryFREF
  479.         },
  480.         /* [2] */
  481.         'ICN#',
  482.         {    /* array IDArray: 2 elements */
  483.             /* [1] */
  484.             0, kDocumentIcons,
  485.             /* [2] */
  486.             1, kStationeryIcons
  487.         }
  488.     }
  489. };
  490.  
  491. resource 'BNDL' (kEditorBundle, "Editor BNDL") {
  492.     kPanelEditorEditorOSType,
  493.     0,
  494.     {    /* array TypeArray: 2 elements */
  495.         /* [1] */
  496.         'FREF',
  497.         {    /* array IDArray: 1 elements */
  498.             /* [1] */
  499.             0, kEditorFREF
  500.         },
  501.         /* [2] */
  502.         'ICN#',
  503.         {    /* array IDArray: 1 elements */
  504.             /* [1] */
  505.             0, kEditorIcons
  506.         }
  507.     }
  508. };
  509.  
  510. resource 'BNDL' (kViewerBundle, "Viewer BNDL") {
  511.     kPanelEditorViewerOSType,
  512.     0,
  513.     {    /* array TypeArray: 2 elements */
  514.         /* [1] */
  515.         'FREF',
  516.         {    /* array IDArray: 1 elements */
  517.             /* [1] */
  518.             0, kViewerFREF
  519.         },
  520.         /* [2] */
  521.         'ICN#',
  522.         {    /* array IDArray: 1 elements */
  523.             /* [1] */
  524.             0, kViewerIcons
  525.         }
  526.     }
  527. };
  528.  
  529. resource 'FREF' (kDocumentFREF) {
  530.     kPanelEditorDocumentOSType, 0, ""
  531. };
  532.  
  533. resource 'FREF' (kStationeryFREF) {
  534.     kPanelEditorStationeryOSType, 1, ""
  535. };
  536.  
  537. resource 'FREF' (kEditorFREF) {
  538.     'shlb', 0, ""
  539. };
  540.  
  541. resource 'FREF' (kViewerFREF) {
  542.     'shlb', 0, ""
  543. };
  544.  
  545. data kODShellSignature (0, "Owner resource") {
  546.     $"00"
  547. };
  548.  
  549. data kPanelEditorViewerOSType (0, "Owner resource") {
  550.     $"00"
  551. };
  552.  
  553. data kPanelEditorEditorOSType (0, "Owner resource") {
  554.     $"00"
  555. };
  556.